2000W / 48V LLC Battery-Charger  V1.00
XMC1000_RomFunctionTable.h
Go to the documentation of this file.
1 /*********************************************************************************************************************
2  * @file XMC1000_RomFunctionTable.h
3  * @brief ROM functions prototypes for the XMC1400-Series
4  * @version V1.0
5  * @date 03 Sep 2015
6  *
7  * @cond
8  *********************************************************************************************************************
9  * Copyright (c) 2015-2016, Infineon Technologies AG
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
13  * following conditions are met:
14  *
15  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
16  * disclaimer.
17  *
18  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided with the distribution.
20  *
21  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
22  * products derived from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with
33  * Infineon Technologies AG dave@infineon.com).
34  *********************************************************************************************************************
35  *
36  **************************** Change history *********************************
37  * V1.0, 03 Sep 2015, JFT : Initial version
38  *****************************************************************************
39  * @endcond
40  */
41 
42 #ifndef ROM_FUNCTION_TABLE_H
43 #define ROM_FUNCTION_TABLE_H
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /* ***************************************************************************
50 ******************************* Constants *******************************
51 *************************************************************************** */
52 /* Start address of the ROM function table */
53 #define ROM_FUNCTION_TABLE_START (0x00000100U)
54 
55 /* Pointer to Erase Flash Page routine */
56 #define _NvmErase (ROM_FUNCTION_TABLE_START + 0x00U)
57 
58 /* Pointer to Erase, Program & Verify Flash Page routine */
59 #define _NvmProgVerify (ROM_FUNCTION_TABLE_START + 0x04U)
60 
61 /* Pointer to Request BMI installation routine */
62 #define _BmiInstallationReq (ROM_FUNCTION_TABLE_START + 0x08U)
63 
64 
65 /* ***************************************************************************
66 ******************************** Enumerations ********************************
67 *************************************************************************** */
68 typedef enum TagNVMStatus
69 {
70 
71 /* The function succeeded */
72  NVM_PASS = (int32_t)0x00010000U,
73 
74 /* Generic error code */
75  NVM_E_FAIL = (int32_t)0x80010001U,
76 
77 /* Source data not in RAM */
78  NVM_E_SRC_AREA_EXCCEED = (int32_t)0x80010003U,
79 
80 /* Source data is not 4 byte aligned */
81  NVM_E_SRC_ALIGNMENT = (int32_t)0x80010004U,
82 
83 /* NVM module cannot be physically accessed */
84  NVM_E_NVM_FAIL = (int32_t)0x80010005U,
85 
86 /* Verification of written page not successful */
87  NVM_E_VERIFY = (int32_t)0x80010006U,
88 
89 /* Destination data is not (completely) located in NVM */
90  NVM_E_DST_AREA_EXCEED = (int32_t)0x80010009U,
91 
92 /* Destination data is not properly aligned */
93  NVM_E_DST_ALIGNMENT = (int32_t)0x80010010U,
94 
95 } NVM_STATUS;
96 
97 
98 /* ***************************************************************************
99 *********************************** Macros ***********************************
100 *************************************************************************** */
101 
102 /* ***************************************************************************
103 Description: Erase granularity = 1 Page of 16 blocks of 16 Bytes
104  = Equivalent to 256 Bytes using this routine.
105 
106 Input parameters:
107 – Logical address of the Flash Page to be erased which must be page aligned
108 and in NVM address range
109 
110 Return status:
111 – OK (NVM_PASS)
112 – Invalid address (NVM_E_DST_ALIGNMENT or NVM_E_DST_AREA_EXCEED)
113 – Operation failed (Error during low level NVM programming driver):
114  NVM_E_FAIL
115  NVM_E_VERIFY
116  NVM_E_NVM_FAIL
117 
118 Prototype:
119  NVM_STATUS XMC1000_NvmErasePage(uint32_t *pageAddr)
120 *************************************************************************** */
121 #define XMC1000_NvmErasePage (*((NVM_STATUS (**) (uint32_t * )) \
122  _NvmErase))
123 
124 /* ***************************************************************************
125 Description: This procedure performs erase (skipped if not necessary), program
126 and verify of selected Flash page.
127 
128 Input parameter:
129 – Logical address of the target Flash Page, must be page aligned and in NVM
130 address range
131 
132 – Address in SRAM where the data starts, must be 4-byte aligned
133 
134 Return status:
135 – OK (NVM_PASS)
136 – Invalid addresses
137  NVM_E_DST_ALIGNMENT
138  NVM_E_SRC_ALIGNMENT
139  NVM_E_DST_AREA_EXCEED
140  NVM_E_SRC_AREA_EXCCEED
141 – Operation failed (Error during low level NVM programming driver):
142  NVM_E_FAIL
143  NVM_E_VERIFY
144  NVM_E_NVM_FAIL
145 
146 Prototype:
147  NVM_STATUS XMC1000_NvmProgVerify(const uint32_t *srcAddr, uint32_t *dstAddr)
148 *************************************************************************** */
149 #define XMC1000_NvmProgVerify (*((NVM_STATUS (**) (const uint32_t * ,\
150  uint32_t * ))\
151  _NvmProgVerify))
152 
153 
154 /* ***************************************************************************
155 Description: This procedure initiates installation of a new BMI value. In
156 particular, it can be used as well as to restore the state upon delivery for a
157 device already in User Productive mode.
158 
159 Input parameter:
160 – BMI value to be installed
161 
162 Return status:
163 – wrong input BMI value (0x01) - only upon error, if OK the procedure triggers
164 a reset respectively does not return to calling routine !
165 
166 Prototype:
167  unsigned long XMC1000_BmiInstallationReq(unsigned short requestedBmiValue)
168 **************************************************************************** */
169 #define XMC1000_BmiInstallationReq (*((uint32_t (**) (uint16_t)) \
170  _BmiInstallationReq))
171 
172 #ifdef __cplusplus
173 }
174 #endif
175 
176 #endif /* ROM_FUNCTION_TABLE_H */
enum TagNVMStatus NVM_STATUS